namespace RPGLibrary.CharacterClasses
{
    public class AttributePair
    {
        public int CurrentValue { get; private set; }
        public int MaximumValue { get; private set; }

        public static AttributePair Zero
        {
            get { return new AttributePair(); }
        }

        private AttributePair()
        {
            CurrentValue = 0;
            MaximumValue = 0;
        }

        public AttributePair(int maxValue)
        {
            CurrentValue = maxValue;
            MaximumValue = maxValue;
        }

        public void Heal(ushort value)
        {
            CurrentValue += value;
            if (CurrentValue > MaximumValue)
                CurrentValue = MaximumValue;
        }

        public void Damage(ushort value)
        {
            CurrentValue -= value;
            if (CurrentValue < 0)
            {
                CurrentValue = 0;
            }
        }

        public void SetCurrent(int value)
        {
            CurrentValue = value;
            if (CurrentValue > MaximumValue)
                CurrentValue = MaximumValue;
        }

        public void SetMaximum(int value)
        {
            MaximumValue = value;
            if (CurrentValue > MaximumValue)
                CurrentValue = MaximumValue;
        }
    }
}